#pragma once

#include <limits>

#include "planner/property_set.h"

namespace optimizer {

class OptimizerContext;
/**
 * OptimizationContext containing information for each optimization.
 * A new OptimizationContext is created when optimizing sub-groups.
 */
class OptimizationContext {
 public:
  OptimizationContext(OptimizerContext *context, PropertySet *required_prop,
                      double cost_upper_bound = std::numeric_limits<double>::max())
      : context_(context), required_prop_(required_prop), cost_upper_bound_(cost_upper_bound) {}

  ~OptimizationContext() { delete required_prop_; }

  OptimizerContext *GetOptimizerContext() const { return context_; }

  PropertySet *GetRequiredProperties() const { return required_prop_; }

  double GetCostUpperBound() const { return cost_upper_bound_; }

  void SetCostUpperBound(double cost) { cost_upper_bound_ = cost; }

 private:
  OptimizerContext *context_;

  PropertySet *required_prop_;

  double cost_upper_bound_;
};

}  // namespace optimizer
